#pragma once
#include <bits/types/time_t.h>
#include <cstdarg>
#include <cstdio>
#include <ctime>
#include<iostream>

#define DEBUG 0
#define NORMAL 1
#define WARNING 2
#define FATAL 3

const char* gLevelMap[]={
    "DEBUG",
    "NORMAL",
    "WARNING",
    "FATAL"
};

void LogMessage(int level,const char* format,...)
{
    char stdbuffer[1024];
    time_t Time=time(nullptr);
    snprintf(stdbuffer,sizeof(stdbuffer),"[%s] [%ld]",gLevelMap[level],Time);
    char logbuffer[1024];
    va_list args;
    va_start(args, format);
    vsnprintf(logbuffer, sizeof(logbuffer), format, args);
    printf("%s:%s\n",stdbuffer,logbuffer);
    va_end(args);
}